package v1

import (
	"github.com/gogf/gf/v2/frame/g"
	"github.com/gogf/gf/v2/os/gtime"
	"star/internal/model"
)

// CreateReq 新增单词

type CreateReq struct {
	g.Meta             `path:"/words" method:"post" sm:"创建单词" tags:"单词"`
	Word               string `json:"word" v:"required#单词不能为空" dc:"单词" binding:"required"`
	Definition         string `json:"definition" v:"required|length:1,300" dc:"单词定义"`
	ExampleSentence    string `json:"example_sentence" v:"required|length:1,300" dc:"例句"`
	ChineseTranslation string `json:"chinese_translation" v:"required|length:1,300" dc:"中文翻译"`
	Pronunciation      string `json:"pronunciation" v:"required|length:1,100" dc:"发音"`
	ProficiencyLevel   uint   `json:"proficiency_level" v:"required|between:1,5" dc:"熟练度，1最低，5最高"`
}
type CreateRes struct {
}

// UpdateReq 更新单词

type UpdateReq struct {
	g.Meta             `path:"/words/{id}" method:"put" sm:"更新" tags:"单词"`
	Id                 uint   `json:"id" v:"required"`
	Word               string `json:"word" v:"required|length:1,100" dc:"单词"`
	Definition         string `json:"definition" v:"required|length:1,300" dc:"单词定义"`
	ExampleSentence    string `json:"example_sentence" v:"required|length:1,300" dc:"例句"`
	ChineseTranslation string `json:"chinese_translation" v:"required|length:1,300" dc:"中文翻译"`
	Pronunciation      string `json:"pronunciation" v:"required|length:1,100" dc:"发音"`
	ProficiencyLevel   uint   `json:"proficiency_level" v:"required|between:1,5" dc:"熟练度，1最低，5最高"`
}
type UpdateRes struct {
}

// 单词列表

type ListReq struct {
	g.Meta `path:"/words" method:"get" sm:"列表" tags:"单词"`
	Word   string `json:"word" dc:"查询单词"`
	Page   int    `json:"page" v:"min:1"  dc:"页面"`
	Size   int    `json:"size"  dc:"每页数量"`
}

type ListRes struct {
	List  []model.WordList `json:"list"`
	Total uint             `json:"total"`
}

// 单词详情

type DetailReq struct {
	g.Meta `path:"/words/{id}" method:"get" sm:"详情" tags:"单词"`
	Id     uint `json:"id" v:"required" dc:"单词ID"`
}
type DetailRes struct {
	Id                 uint        `json:"id"                 orm:"id"                  description:""` //
	Word               string      `json:"word"               orm:"word"                description:""` //
	Definition         string      `json:"definition"         orm:"definition"          description:""` //
	ExampleSentence    string      `json:"exampleSentence"    orm:"example_sentence"    description:""` //
	ChineseTranslation string      `json:"chineseTranslation" orm:"chinese_translation" description:""` //
	Pronunciation      string      `json:"pronunciation"      orm:"pronunciation"       description:""` //
	ProficiencyLevel   uint        `json:"proficiencyLevel"   orm:"proficiency_level"   description:""` //
	CreatedAt          *gtime.Time `json:"createdAt"          orm:"created_at"          description:""` //
	UpdatedAt          *gtime.Time `json:"updatedAt"          orm:"updated_at"          description:""` //
}

//删除单词

type DeleteReq struct {
	g.Meta `path:"/words/{id}" method:"delete" sm:"删除" tags:"单词"`
	Id     uint `json:"id" v:"required" dc:"单词ID"`
}
type DeleteRes struct {
}
